import { Request } from "../utils/request.js";
//配置统一接口文件，方便我们的后期更新以及维护

//full name  wsp
// function  登录接口
//specific date   2022/8/24/16:56
export const login = (data) => Request({
	url: `/api/user/login.do`,
	method: 'post',
	params: {...data}
});

//full name  wsp
// function  首页信息接口
//specific date   2022/8/24/17:05
export const home = () =>Request({
	url: `/api/statistic/base_count.do`,
	method: 'get',
});

//full name  wsp
// function  用户信息接口
//specific date   2022/8/25/19:00
export const userList=(data)=>Request({
	url:`/api/user/list.do`,
	method:"post",
	params:{...data},
});

//full name  wsp
// function  用户分页接口
//specific date   2022/8/25/19:07
export const user=(obj,data)=>Request({
	url:`/api/user/list.do?pageNum=${obj}`,
	method:"get",
	params:data
});

//full name  wsp
// function  商品管理数据
//specific date   2022/8/25/19:07
export const price=(data)=>Request({
	url:`/api/product/list.do`,
	method:"get",
	data
});

//full name  wsp
// function  商品管理详情
//specific date   2022/8/25/19:07
export const GoodList=(data)=>Request({
	url:`/api/product/list.do`,
	method:"get",
	data
});

export const Goods=(id,data)=> Request({
	url:`/api/category/get_category.do?categoryId=${id}`,
	method:"Get",
	data
});

//full name  wsp
// function  商品管理分页
//specific date   2022/8/25/19:07
export const Page=(size,data)=> Request({
	url:`/api/product/list.do?pageNum=${size}`,
	method:"Get",
	data
});

//full name  wsp
// function  商品管理列表搜索
//specific date   2022/8/25/19:07
export const priceSearch=(obj,data)=> Request({
	url:`/api/product/search.do?listType=search&pageNum=${obj.pageNum}&productId=${obj.productId}`,
	method:"Get",
	data
});
export const priceSearch1=(obj,data)=> Request({
	url:`/api/product/search.do?listType=search&pageNum=${obj.pageNum}&productName=${obj.productName}`,
	method:"Get",
	data
});

//full name  wsp
// function  上架下架
//specific date   2022/8/25/19:07
export const Pgg=(obj,data)=> Request({
	url:`/api/product/list.do?listType=search&pageNum=${obj.PageNum}&productName=${obj.productName}`,
	method:"Get",
	data
});

//full name  wsp
// function  上架下架
//specific date   2022/8/25/19:07
export const up= (obj,data)=>Request({
	url:`/api/product/set_sale_status.do?productId=${obj.productid}&status=${obj.status}`,
	method:"Get",
	data
});

//full name  wsp
// function  修改查看
//specific date   2022/8/25/19:07
export const faker=(data)=> Request({
	url:`/api/category/get_category.do`,
	method:"Get",
	data
});

//品类修改
export const fakermove= (obj,data)=>Request({
	url:`/api/category/set_category_name.do?categoryId=${obj.id}&categoryName=${obj.name}`,
	method:"Get",
	data
});

//商品添加
export const cook=(list,data)=> Request({
	url:`/api/product/save.do?categoryId=${list.categoryId}&name=${list.name}&subtitle=${list.subtitle}&subImages=${list.subImages}&detail=${list.detail}&price=${list.price}&stock=${list.stock}&status=${list.status}&region=${list.region}`,
	method:"Get",
	data
});

export const add=(id,data)=> Request({
	url:`/api/category/get_category.do?categoryId=${id}`,
	method:"Get",
	data
});

//商品修改
export const coos=(list,data)=> Request({
	url:`/api/product/save.do?categoryId=${list.categoryId}&name=${list.name}&subtitle=${list.subtitle}&subImages=${list.subImages}&detail=${list.detail}&price=${list.price}&stock=${list.stock}&status=${list.status}&id=${list.id}`,
	method:"Get",
	data
});

//订单管理
export const good=(data)=>Request({
	url:`/api/order/list.do`,
	method:"get",
	data
});

//订单分页
export const goodsize=(page,data)=>Request({
	url:`/api/order/list.do?pageNum=${page}`,
	method:"get",
	data
});

//订单搜索
export const goodSearch=(input,data)=>Request({
	url:`/api/order/search.do?orderNo=${input}`,
	method:"GET",
	data
});

//上传图片
export const img = (data)=>Request({
	url:`/api/product/upload.do`,
	method:"Get",
	data
});

//品类查看
export const fakerlist= (obj,data)=>Request({
	url:`/api/category/get_category.do?categoryId=${obj}`,
	method:"Get",
	data
});

//品类添加
export const fakeradd= (obj,data)=>Request({
	url:`/api/category/get_category.do?categoryId=${obj}`,
	method:"Get",
	data
});

export const fakerok= (obj,data)=>Request({
	url:`/api/category/add_category.do?parentId=${obj.id}&categoryName=${obj.name}`,
	method:"Get",
	data
});

export const fakersave= (obj,data)=>Request({
	url:`/api/category/set_category_name.do?categoryId=${obj.id}&categoryName=${obj.name}`,
	method:"Get",
	data
});
